﻿<%@ page language="java" import="com.newcrm.bean.*,com.newcrm.config.*,com.newcrm.util.Util,java.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
  User user = (User) session.getAttribute("user");
  Map<Integer, CompanyInfo> companys = (Map<Integer, CompanyInfo>) application.getAttribute(Const.APPLICATION_COMPANYS);
  CompanyInfo companyInfo = companys.get(Integer.valueOf(user.companyId));
  String companyName = companyInfo.name;
  List<Map<String, Object>> dealCategory = companyInfo.dealCategorys;
  List<Map<String, Object>> customerCategorys = companyInfo.customerCategorys;
  List<Map<String, Object>> companyTags = companyInfo.tags;
  List<User> users = companyInfo.users;
  List<Group> allGroups = companyInfo.getAllGroups();
  List<Map<String, Object>> noteDefaultWords = companyInfo.noteDefaultWords;

  // 用户所属部门
  Group userGroup = companyInfo.getGroupById(user.groupId);

  // 部门公海开关设置
  boolean isCloseGroupPublicData = companyInfo.isCloseGroupPublicData();

  // 公海客户只读设置
  String setPublicReadOnlyFlag = companyInfo.setPublicReadOnlyFlag;

  String notContactType = (String) request.getAttribute("notContactType");
  if (notContactType == null) {
    notContactType = "";
  }

  String tagId = (String) request.getAttribute("tagId");
  if (tagId == null) {
    tagId = "";
  }
  String nextDate = (String) request.getAttribute("nextDate");
  if (nextDate == null) {
    nextDate = "";
  }
  String contactDate = (String) request.getAttribute("contactDate");
  if (contactDate == null) {
    contactDate = "";
  }
  String importId = (String) request.getAttribute("importId");
  if (importId == null) {
    importId = "";
  }
  //客户自定义字段
  List<Map<String, Object>> fields = (List<Map<String, Object>>) request.getAttribute("fields");

  //销售自定义字段
  List<Map<String, Object>> dealFields = (List<Map<String, Object>>) request.getAttribute("dealFields");

  Date syncTime = (Date)request.getAttribute("syncTime");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>客户一览</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="renderer" content="webkit"/>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/qikebao.ico" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/all.css?ver=<%=Const.VERSION%>">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/datepicker.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap-datetimepicker.min.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap-wysihtml5.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/uploadify.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/magnific-popup.css">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/jquery.mCustomScrollbar.css">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/jplayer.blue.monday.min.css">
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-1.11.1.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-ui.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-ui-effect.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.mCustomScrollbar.concat.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.bootstrap-growl.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/moment.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-datepicker.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-datetimepicker.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/daterangepicker.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.magnific-popup.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.cookie.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.uploadify.v3.2.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/popbox.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/parties.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/partiesSearch.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/pageNavi.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/area.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/common.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerCompany.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerDetailTag.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerDetailNote.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerDetailCallRecords.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerDetailDeals.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerDetailImportantDate.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerDetailSearchEngine.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerDetail.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/json2.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/sendmail.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/rightTask.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.jplayer.min.js?ver=<%=Const.VERSION%>"></script>
  <script>
    var _setPublicReadOnlyFlag = "<%=setPublicReadOnlyFlag%>";
    var _visible_person = '<%=Const.VISIBLE_PERSON%>';
    var _notContactType = '<%=notContactType%>';
    var pageSize = <%=user.getCustomerPageSize()%>;
    params.TagIds = '<%=tagId%>';
    params.ImportId = '<%=importId%>';
    <%if (nextDate.length() > 0) {
      if (nextDate.indexOf("~") > 0) {%>
    params["nextContactDate_2_1"] = "<%=nextDate%>";
      <%} else {%>
    params["nextContactDate_2_1"] = "~ <%=nextDate%>";
      <%}
    }%>
    <%if (contactDate.length() > 0) {
      if (contactDate.indexOf("~") > 0) {%>
    params["lastContactDate_2_1"] = "<%=contactDate%>";
      <%} else {%>
    params["lastContactDate_2_1"] = "<%=contactDate%> ~ <%=contactDate%>";
      <%}
    }%>

    var _share_type_user = '<%=Const.SHARE_TYPE_USER%>';
    var _share_type_group = '<%=Const.SHARE_TYPE_GROUP%>';

    var customerCategorys = new Array();
    <%if (customerCategorys != null) {
        for (Map<String, Object> category:customerCategorys) {
          String color = (String) category.get("Color");
          if (color == null || color.trim().length() == 0) {
            color = "000000";
          }%>
    customerCategorys.push({id:"<%=category.get("CategoryId")%>",name:"<%=Util.UEncode((String)category.get("CategoryName"))%>", color:"<%=color%>"});
      <%}
    } %>
    var allDealsCategory = new Array();
    <%if (dealCategory != null) {
        for (Map<String, Object> category:dealCategory) {
          String color = (String) category.get("Color");
          if (color == null || color.trim().length() == 0) {
            color = "000000";
          }
        %>
    allDealsCategory.push({id:"<%=category.get("DealCategoryId")%>",name:"<%=Util.UEncode((String)category.get("DealCategoryName"))%>", color:"<%=color%>"});
    <%  }
      } %>

    // 预处理所有的员工，为js文件准备
    var allUsers = new Array();
    <%if (users != null) {
        for (User u:users) { %>
    allUsers.push({id:"<%=u.userId%>",name:"<%=Util.UEncode(u.name)%>",photo:"<%=u.imgPath%>"});
    <%  }
      } %>

    // 预处理所有的部门，为js文件准备
    var allGroups = new Array();
    <%if (allGroups != null) {
        for (Group g:allGroups) { %>
    allGroups.push({id:"<%=g.getId()%>",name:"<%=Util.UEncode(g.getName())%>"});
    <%  }
      } %>

    var allCustomerFields = new Array();
    allCustomerFields.push({id:"<%=Const.CUSTOMER_EXT_INFO_TYPE_PHONE%>",name:"电话"});
    allCustomerFields.push({id:"<%=Const.CUSTOMER_EXT_INFO_TYPE_EMAIL%>",name:"邮箱"});
    allCustomerFields.push({id:"<%=Const.CUSTOMER_EXT_INFO_TYPE_IM%>",name:"QQ"});
    allCustomerFields.push({id:"<%=Const.CUSTOMER_EXT_INFO_TYPE_WEBSITE%>",name:"网址"});
    allCustomerFields.push({id:"<%=Const.CUSTOMER_EXT_INFO_TYPE_ADDRESS%>",name:"地址"});
   <%if (fields != null) {
        for (Map<String, Object> field:fields) {
        %>
    allCustomerFields.push({id:"<%=field.get("CustomerFieldId")%>",name:"<%=Util.UEncode((String)field.get("CustomerFieldName"))%>"});
    <%  }
      } %>
    var field_type_text = "<%=Const.FIELD_TYPE_TEXT%>";
    var field_type_number = "<%=Const.FIELD_TYPE_NUMBER%>";
    var field_type_date = "<%=Const.FIELD_TYPE_DATE%>";
    var field_type_select = "<%=Const.FIELD_TYPE_SELECT%>";
    var field_type_checkbox = "<%=Const.FIELD_TYPE_CHECKBOX%>";
    var visible_person = "<%=Const.VISIBLE_PERSON%>";
    var visible_group = "<%=Const.VISIBLE_GROUP%>";
    var visible_everyone = "<%=Const.VISIBLE_EVERYONE%>";
    var visible_share_owner = "<%=Const.VISIBLE_SHARE_OWNER%>";
    var visible_share_other = "<%=Const.VISIBLE_SHARE_OTHER%>";

    var sort_type = "<%=Const.SORT_LASTCONTACTDATE%>";

    //customer detail
    var loginUserId = '<%=user.userId%>';
    var loginGroupId = '<%=user.groupId%>';
    var isAdmin = <%=user.isAdmin%>;
    var ext_Type_email = <%=Const.CUSTOMER_EXT_INFO_TYPE_EMAIL%>;
    var ext_Type_im = <%=Const.CUSTOMER_EXT_INFO_TYPE_IM%>;
    var ext_Type_phone = <%=Const.CUSTOMER_EXT_INFO_TYPE_PHONE%>;
    var ext_Type_website = <%=Const.CUSTOMER_EXT_INFO_TYPE_WEBSITE%>;
    var ext_Type_address = <%=Const.CUSTOMER_EXT_INFO_TYPE_ADDRESS%>;
    var customerId = '';
    var customerIds = '';
    var subjectType;
    var parentCustomerId = '';
    var noteType = '';
    var categoryId = '';
    var isPerson;
    var showExtInfoTypeIds = "<%=user.getShowCustomeFieldTypeIds()%>";

    // 销售机会自定义字段
    var allCustomerDealFields = new Array();
   <%if (dealFields != null) {
        for (Map<String, Object> field:dealFields) {
        %>
    allCustomerDealFields.push({id:"<%=field.get("DealFieldId")%>",name:"<%=Util.UEncode((String)field.get("DealFieldName"))%>"});
    <%  }
     } %>

  </script>
</head>
<body class="parties">
  <jsp:include page="topNavi.jsp" flush="true"/>
  <div class="main-page">
    <table>
    <tr>
      <td class="main-body">
        <div class="topnavi">
          <div class='popbox leftMenu'>
            <a class='open' href="#"><span id="viewmodeMessage">我的客户</span> <i class="fa fa-chevron-down"></i></a>
            <div class='collapse'>
              <div class='box'>
                <div class='arrow'></div><div class='arrow-border'></div>
                <form>
                <h1>请选择查看方式：</h1>
                <ul>
                  <li><label><input name="customerVisible" value="<%=Const.VISIBLE_EVERYONE%>" type="radio"/> 公海客户</label>
                    <select id="groupPermissionsId" >
                      <% if (user.isAdmin && !isCloseGroupPublicData) {%>
                      <option value="<%=Const.PERMISSIONSID_ALL%>" t="group">全部公海客户</option>
                      <% }%>
                      <jsp:include page="commonPublicDataSelection.jsp" flush="true"/>
                    </select>
                  </li>
                  <li>
                    <label><input name="customerVisible" value="<%=Const.VISIBLE_PERSON%>" checked type="radio"/> 按员工查看客户</label>
                    <select id="customerPermissionsId" >
                      <% if (user.isAdmin) {%>
                      <option value="*">所有员工的客户</option>
                      <%}%>
                      <jsp:include page="commonUserSelection.jsp" flush="true"/>
                    </select>
                  </li>
                  <% if (user.isAdmin) {
                      if (allGroups != null && allGroups.size() > 0) {%>
                  <li>
                    <label><input name="customerVisible" value="<%=Const.VISIBLE_GROUP%>" type="radio"/> 按部门查看员工所属客户</label>
                    <select id="customerGroupId" >
                    <%for (Group group:allGroups) {%>
                      <option value="<%=group.getId()%>"><%=group.getIndentName()%></option>
                    <%}%>
                    </select>
                  </li>
                    <%}
                    } else if (user.isGroupAdmin) { %>
                  <li>
                    <label><input name="customerVisible" value="<%=Const.VISIBLE_GROUP%>" type="radio"/> 按部门查看员工所属客户</label>
                    <select id="customerGroupId" >
                  <%  if (userGroup != null) {
                        for (Group group:userGroup.getAllGroups()) { %>
                      <option value="<%=group.getId()%>"><%=group.getIndentName()%></option>
                  <%
                        }
                      } %>
                    </select>
                  <%}%>
                  <li><label ><input name="customerVisible" value="<%=Const.VISIBLE_SHARE_OWNER%>" checked type="radio"/> 我共享的客户</label></li>
                  <li><label ><input name="customerVisible" value="<%=Const.VISIBLE_SHARE_OTHER%>" checked type="radio"/> 共享给我的客户</label></li>
                </ul>
                <p>
                  <a id="changeViewMode-link" class="button blue small closePopbox" href="#"><i class="fa fa-check"></i> 确定</a>
                  <a class="button grey small closePopbox" href="#"><i class="fa fa-times"></i> 取消</a>
                </p>
                </form>
              </div>
            </div>
          </div>
          <div class="clearfix"></div>
        </div>

        <div class="fixbar" id="fixbar">
          <div class="switchTab" id="switchTab">
            <ul>
              <li id="switchTab_0" class="on"><a class="item" href="#" v="0">全部客户</a></li>
              <li id="switchTab_1" class="dropdown">
                <a class="item" href="#" v="1" date="1">所有未联系客户</a><a href="#" data-toggle="dropdown" class="dropMenuarrow"><span><i class="fa fa-caret-down"></i></span></a>
                <ul class="dropdown-menu">
                  <li><a href="#" date="1">所有未联系客户</a></li>
                  <li><a href="#" date="2">超过一周未联系</a></li>
                  <li><a href="#" date="3">超过两周未联系</a></li>
                  <li><a href="#" date="4">超过一月未联系</a></li>
                  <li><a href="#" date="0">高级搜索</a></li>
                </ul>
              </li>
              <li id="switchTab_2" class="last dropdown">
                <a class="item" href="#" v="2" date="1">今天联系客户</a><a href="#" data-toggle="dropdown" class="dropMenuarrow"><span><i class="fa fa-caret-down"></i></span></a>
                <ul class="dropdown-menu">
                  <li><a href="#" date="1">今天联系客户</a></li>
                  <li><a href="#" date="2">昨天联系客户</a></li>
                  <li><a href="#" date="3">本周联系客户</a></li>
                  <li><a href="#" date="4">最近2周联系</a></li>
                  <li><a href="#" date="5">本月联系客户</a></li>
                  <li><a href="#" date="0">高级搜索</a></li>
                </ul>
              </li>
            </ul>
            <div class="searcharea">
              <input type="text" id="sidebar_live_search" name="term" class="searchinput" value="" title="输入名称，快速查找客户">
              <div class="searchinputicon"><span><a title="搜素" id="sidebar_live_search_link" href="#"><i class="fa fa-search"></i></a></span><span class="vline"> | </span> <span><a title="高级搜索" href="#" id="show-adv-search-link"><i class="fa fa-caret-down"></i></a></span></div>
            </div>
            <div class="clearfix"></div>
          </div>

          <jsp:include page="partiesSearchFilter.jsp" flush="true"/>

          <div class="toolbar" id="toolbarContainer">
            <div class="right" id="topPageNavi"><span id="currentpage"></span> / <span id="totalpage"></span><a title="上一页" id="prev-link" href="#" class="iconbutton"><i class="fa fa-chevron-left"></i></a> <a id="next-link" title="下一页" href="#" class="iconbutton"><i class="fa fa-chevron-right"></i></a></div>
            <div id="toolbar">
              <a id="selectall-link" title="全选/全不选" href="#" class="button grey small"><i id="selectall-icon" class="fa fa-square-o"></i> 全选</a>
              <% if (user.isCanDelete()) {%><a message="请选择需要删除的客户" href="#delete-popup" title="删除选择的客户信息" class="popup-link button grey small"><i class="fa fa-times"></i> 删除</a><%}%>
              <a id="visibility_change_link" message="请选择需要转移的客户" href="#changevisibility-popup" title="将选择的客户转移到自己或其他同事名下" class="popup-link button grey small"><i class="fa fa-unlock"></i> 转移客户</a>
              <span class="dropdown">
                <a href="#" title="排序" data-toggle="dropdown" class="button grey small"><i class="fa fa-sort-alpha-asc"></i> 排序</a>
                <ul class="dropdown-menu" id="sort_menu">
                  <li><a href="lastContactDate" id="sort_lastContactDate" class="on"><i class="fa fa-check"></i> 最后联系时间</a></li>
                  <li><a href="Name" id="sort_Name"><i class="fa fa-check"></i> 客户名称</i></a></li>
                  <li><a href="CreateDate" id="sort_CreateDate"><i class="fa fa-check"></i> 创建时间</a></li>
                </ul>
              </span>
              <span class="dropdown">
                <a href="#" title="更多操作" data-toggle="dropdown" class="button grey small"><i class="fa fa-chevron-down"></i> 更多操作</a>
                <ul class="dropdown-menu" id="operationMenu">
                  <li><a id="add_share_link" message="请选择需要共享的客户" href="#setshare-popup" title="将选择的客户共享给其他同事" class="popup-link"><i class="fa fa-share-alt"></i> 共享客户</a></li>
                  <li><a id="remove_share_link" style="display:none;" message="请选择需要取消共享的客户" href="#removeshare-popup" title="取消客户信息的共享" class="popup-link"><i class="fa fa-share-alt"></i> 取消共享</a></li>
                  <li><a id="add_tag_link" message="请选择需要添加标签的客户" href="#addtag-popup" title="添加客户标签" class="popup-link"><i class="fa fa-tag"></i> 添加客户标签</a></li>
                  <li><a id="change_category_link" message="请选择需要修改分类的客户" href="#category-popup" title="修改客户分类" class="popup-link"><i class="fa fa-tasks"></i> 修改客户分类</a></li>
                  <li><a id="nextContactDate_change_link" message="请选择需要设置下次联系的客户" href="#nextcontact-popup" title="设置下次联系时间" class="popup-link"><i class="fa fa-bell-o"></i> 设置下次联系时间</a></li>
                </ul>
              </span>
            </div>
          </div>
        </div>
        <div class="loading" id="parties_loading">
          <div class="liner">
            <h3>加载中...</h3>
            <img alt="加载中" src="<%=request.getContextPath()%>/images/dots-white.gif" />
          </div>
        </div>
        <div id="blank_slate" class="loading">
          <div class="liner">
            <h3>没有符合条件的客户信息</h3>
          </div>
        </div>
        <div class="searchresult" id="searchresult">
          <div class="selectTips" id="selectTips">
            <span id="tips">已勾选本页 <%=user.getCustomerPageSize()%> 个客户，<a href="#" id="selectAll_link">勾选全部 <b id="selTotalNum"></b> 个客户</a></span>
            <span id="undotips">已勾选 <b id="selTotalNum2"></b> 个客户，<a href="#" id="unselectAll_link">取消勾选</a></span>
          </div>
          <div class="customers_list" id="contactsList"></div>
          <div class="pagination"><div class="page-bottom" id="pageNavi"></div></div>
        </div>
      </td>
      <td class="main-sidebar">
        <div class="content">
          <h2 class="clearfix">可以方便地导入/导出客户信息</h2>
          <div class="detail"><a href="<%=request.getContextPath()%>/customerimports/new" >导入</a>
          <% if (user.isCanExport()) {%>
          或
          <a href="#" id="exportParties">导出</a>
          <%}%> 客户信息
          <% if (user.isCanExport()) {%><div style="padding-top:10px;"><a href="#" id="show_export_history_link"><i class='fa fa-download'></i> 查看导出历史记录</a></div><%}%>
          </div>
          <h2 class="clearfix">客户分类</h2>
          <div class="categorylist top10" id="categorylist"><div class="clearfix"><span categoryid="0,-1" class="checkbox-button"><i class="fa fa-fw fa-square-o"></i> 无分类</span></div></div>
          <div class="clearfix"></div>
          <h2 class="clearfix">标签列表</h2>
          <div class="taglist top10" id="taglist">
           <% if ((companyTags != null) && (companyTags.size() > 0)) {
              for (Map<String, Object> tag:companyTags) { %>
            <span class="checkbox-button" v="0" tagid="<%=tag.get("TagId")%>"><i class="fa fa-fw fa-square-o"></i> <%=Util.HTMLEncode((String)tag.get("TagName"))%></span>
          <%}}%>
          </div>
        </div>
      </td>
    </tr>
    </table>
  </div>
  <div id="delete-popup" v="0" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">您确信要删除这些客户信息吗？</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      客户被删除后，所有相关备注，任务和文件都将被删除。并且不可恢复。
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="delete-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="category-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">修改客户分类</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      请选择客户分类：<select id="category-popup-sel"><option value="">无</option></select> <% if (user.isAdmin) {%><a href="<%=request.getContextPath()%>/customercategory" target="_blank">设置客户分类</a><%}%>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="changecategory-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="nextcontact-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">设置下次联系时间</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      下次联系时间：<div class="datetimepicker_container"><input type="text" id="nextcontact_date_popup" class="datetimepickerinput"></div>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="setNextContactDate-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="changevisibility-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">转移客户</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div id="change_visibility_group" class="popup-content">
      将选择客户转到：
      <div class="scope">
        <label><input name="visible" type="radio" value="<%=Const.VISIBLE_EVERYONE%>" /> 公海数据</label>
          <div class="editor">
            <select id="groupPermissionsSelectedId">
              <jsp:include page="commonPublicDataSelection.jsp" flush="true"/>
            </select>
          </div>
      </div>
      <div id="change_visibility_person" class="scope">
        <label><input checked="checked" name="visible" type="radio" value="<%=Const.VISIBLE_PERSON%>" /> 私有数据(可以勾选多个员工平均分配)</label>
        <div class="editor">
          <label id="shareUserId_<%=user.userId%>"><input checked="checked" name="change_visibility_permissionsId" type="checkbox" value="<%=user.userId%>" /> 我</label>
          <%
            String groupName = null;
              for (User u : users) {
                if (u.userId.equals(user.userId)) {
                  continue;
                }
                if (!companyInfo.isGroupAdmin(user, u.groupId)) {
                  continue;
                }
                String gn = companyInfo.getGroupName(u);
                if (gn != null && !gn.equals(groupName)) {
                  groupName = gn;  %>
                <p style="padding:10px 0px"><%=Util.HTMLEncode(groupName)%></p>
              <%}%>
              <label id="shareUserId_<%=u.userId%>"><input name="change_visibility_permissionsId" type="checkbox" value="<%=u.userId%>" /> <%=Util.HTMLEncode(u.name)%></label>
             <%}%>
        </div>
      </div>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="changevisibility-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="setshare-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">设置客户共享</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <h3>将选择客户共享给：</h3>
      <!--
      <div id="share_group" class="scope">
        <label>部门:</label>
        <div class="editor">
        <% if (allGroups != null) {
            for (Group group : allGroups) {%>
              <label id="shareGroupId_<%=group.getId()%>"><input name="shareGroupId" type="checkbox" value="<%=group.getId()%>" /> <%=Util.HTMLEncode(group.getName())%></label>
        <%  }
           } 
        %>
        </div>
      </div>
      -->
      <div id="share_person" class="scope">
        <label>个人:</label>
        <div class="editor">
        <%
          String groupNameForShare = null;
          for (User u : users) {
            if (u.userId.equals(user.userId)) {
              continue;
            }
            String gn = companyInfo.getGroupName(u);
            if (gn != null && !gn.equals(groupNameForShare)) {
              groupNameForShare = gn;  
        %>
        <p><%=Util.HTMLEncode(groupNameForShare)%></p>
        <%  }%>
        <label id="shareUserId_<%=u.userId%>"><input name="shareUserId" type="checkbox" value="<%=u.userId%>" /> <%=Util.HTMLEncode(u.name)%></label>
        <%}%>
        </div>
      </div>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="setshare-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
 </div>

  <div id="removeshare-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">取消客户共享</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      取消共享后，其他同事讲无法查看客户信息。
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="removeshare-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="addtag-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">添加标签</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      添加标签：
      <% if ((companyTags != null) && (companyTags.size() > 0)) { %>
      <select id="selAddtag">
      <%for (Map<String, Object> tag:companyTags) { %><option value="<%=tag.get("TagId")%>"><%=Util.HTMLEncode((String)tag.get("TagName"))%></option><%}%>
      </select>
      <%}%>
      <% if (user.isAdmin) {%><a href="<%=request.getContextPath()%>/tag" target="_blank">设置标签</a><%}%>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="addtag-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="deletenote-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">删除备注信息</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      确认要删除该备注信息吗？
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="deletenote-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="searchEngine_template" class="recording" style="display:none">
    <div class="listview">
      <div class="title"></div>
      <div class="body"></div>
    </div>
  </div>

  <div class="contact_date_wrapper" id="contact_date_template" style="display:none">
    <div class="contact_date">
      <p>
        <span class="edit_links">
          <a href="#" title="修改重要日期" class="edit"><i class="fa fa-pencil"></i> &nbsp;</a>
          <a class="delete" title="删除重要日期" href="#"><i class="fa fa-trash-o"></i> &nbsp;</a>
        </span>
        <span class="content_date"></span>
        <span class="content_type"></span>
      </p>
      <div class="inline_edit" style="display:none;">
        <div class="inner">
          <h4>修改日期提醒</h4>
          <div style="padding-bottom:10px;">
            <select class="occasion">
              <option value="生日">生日</option>
              <option value="周年纪念">周年纪念</option>
              <option value="第一次见面">第一次见面</option>
              <option value="服务到期时间">服务到期时间</option>
              <option value="">其他...</option>
            </select>  <input type="text" class="description" value="" style="height:18px;width:450px;display:none;">
          </div>
          <div>
            <select class="month">
              <option value="1">一月</option>
              <option value="2">二月</option>
              <option value="3">三月</option>
              <option value="4">四月</option>
              <option value="5">五月</option>
              <option value="6">六月</option>
              <option value="7">七月</option>
              <option value="8">八月</option>
              <option value="9">九月</option>
              <option value="10">十月</option>
              <option value="11">十一月</option>
              <option value="12">十二月</option>
            </select>
            <select class="day">
              <% for (int i = 1; i < 32; i++) {%>
              <option value="<%=i%>"><%=i%></option>
              <%}%>
            </select>
            <select class="year">
              <option value="0">每年</option>
              <% for (int i = 1950; i < 2021; i++) {%>
              <option value="<%=i%>"><%=i%></option>
              <%}%>
            </select>
          </div>
          <p class="submit">
            <a class="button blue small" href="#"><i class="fa fa-check"></i> 修改</a>
            <a class="button grey small" href="#"><i class="fa fa-times"></i> 取消</a>
          </p>
         </div>
       </div>
    </div>
  </div>

  <div id="customerDetail" class="customerdetailContainer">
    <div id="customerDetail_sub" class="detail customerdetail min">
      <div id="customerDetail_loading" class="loading">
        <div class="liner">
          <h3>加载中...</h3>
          <img alt="加载中" src="<%=request.getContextPath()%>/images/dots-white.gif" />
        </div>
      </div>
      <div class="title min">
        <table>
        <tr>
          <td class="avatar"><img id="customer_avatar" src="<%=request.getContextPath()%>/images/avatar_company.png"></td>
          <td>
            <div class="rightarea">
              <div class="operationIcons">
                <a href="#" id="open_customer_link" target="_blank" title="新窗口打开客户详细信息页面" class="iconbutton"><i class="fa fa-external-link"></i></a>
                <a href="#" id="modify_customer_link" target="_blank" title="修改客户信息" class="iconbutton"><i class="fa fa-pencil"></i></a>
                <% if (user.isCanDelete()) {%><a title="删除客户" class="iconbutton" id="delete_customer_link" href="#delete-popup"><i class="fa fa-trash-o"></i></a><%}%>
                <a title="查看上一个客户" id="customer_prev_link" class="iconbutton" href="#"><i class="fa fa-chevron-left"></i></a>
                <a title="查看下一个客户" id="customer_next_link" class="iconbutton" href="#"><i class="fa fa-chevron-right"></i></a>
              </div>
              <div class="avatars" id="viewUserAvatars"></div>
            </div>
            <h1><span id="categoryName" title="客户分类" class="category"></span><span id="customer_Name"></span> <a id="open_phone_link" href="#callphone-popup" class="noiconbutton green small">打电话</a> <a id="open_email_link" href="#emailEditor-popup" class="noiconbutton blue small">发邮件</a></h1>
            <div id="customer_title_and_company" class="title_and_company"></div>
            <div class="tags" id="show_tags"><span></span><a class="tag" id="showmodifytag-link" href="#"><i class="fa fa-pencil"></i> 修改标签</a></div>
            <div class="edittags" id="edit_tags">
              <div>
           <% if ((companyTags != null) && (companyTags.size() > 0)) {
            for (Map<String, Object> tag:companyTags) { %>
                <span id="allTags_<%=tag.get("TagId")%>" class="checkbox-button" v="0" tagid="<%=tag.get("TagId")%>"><i class="fa fa-fw fa-square-o"></i> <%=Util.HTMLEncode((String)tag.get("TagName"))%></span>
          <%}}%>
              </div><div class="clearfix"></div>
              <div>
                <a id="modifytag-link" class="button green small" href="#"><i class="fa fa-check"></i> 确定</a>
                <a id="modifytag-cancel-link" class="button grey small" href="#"><i class="fa fa-times"></i> 取消</a>
              </div>
            </div>
          </td>
        </tr>
        </table>
      </div>
      <div class="body min">
        <table>
          <tr>
            <td class="content">
              <div class="switches">
                <a id="noteTabHeader" href="#notes_and_emails" class="activated">备注</a>
                <a id="peopleTabHeader" href="#people">联系人<span id="customer_peopleNum"></span></a>
                <a href="#callRecords">通话</a>
                <a href="#deals">销售机会</a>
                <a href="#dates">重要日期</a>
                <a id="searchEngineTabHeader" href="#searchEngineResult">资讯</a>
                <!--<a id="businessArchivesTabHeader" href="#businessArchives">工商</a>-->
              </div>
              <div class="switchable">
                <div id="notes_and_emails" class="switchableContainer">
                  <div class="inputarea">
                    <textarea cols="40" data-focus-priority="1" id="reMark" rows="16" style="width:99%;height:60px"></textarea>
                    <div id="noteInput" class="bottom">
                      <span>
                        <a title="添加文件" class="iconbutton" href="file"><i class="fa fa-paperclip"></i></a>
                        <a title="设置下次联系时间" class="iconbutton" href="date"><i class="fa fa-bell-o"></i></a>
                        <a title="联系对象" class="iconbutton" id="desc_user_link" href="user"><i class="fa fa-user"></i></a>
                        <div class="desc file" id="desc_file">
                          <div class="icon"><div class="iconbg"></div></div>
                          <div><input type="file" id="file_upload" name="file_upload" /></div>
                        </div>
                        <div class="desc date" id="desc_date">
                          <div class="icon"><div class="iconbg"></div></div>
                          <div>设置下次联系时间：<div class="datetimepicker_container"><input type="text" id="nextcontact_date" class="datetimepickerinput"></div></div>
                        </div>
                        <div class="desc user" id="desc_user">
                          <div class="icon"><div class="iconbg"></div></div>
                          <div>
                            <p>请选择联系的联系人：</p>
                            <div style="padding-top:10px;" id="selectPeoples">
                              <label><input id="noPeople" name="contactPeople" v="" checked type="radio" value="" /> 无</label>
                            </div>
                          </div>
                        </div>
                      </span>
                      <span class="right">
                        <span id="addnote-message">备注添加成功!</span>
                        <a href="#" id="addnote-link" class="noiconbutton green">添加备注</a><a href="#" id="notedropmenu-link" class="addonicon"><i class="fa fa-chevron-down"></i> </a>
                        <div class="menu">
                          <ul>
                          <% if ((noteDefaultWords != null) && (noteDefaultWords.size() > 0)) {
                          for (Map<String, Object> defaultword:noteDefaultWords) { %>
                            <li><a href="#" class="n"><%=Util.HTMLEncode((String)defaultword.get("DefaultWord"))%></a></li>
                          <%  }
                            }%>
                          <% if (user.isAdmin) {%>
                                <li><a class="topline" target="_blank" href="<%=request.getContextPath()%>/noteDefaultWord"><i class="fa fa-gear"></i> 设置常用回复</a></li>
                          <%}%>
                          </ul>
                        </div>
                      </span>
                    </div>
                  </div>
                  <div class="clearfix"></div>
                  <div id="notes_loading" class="loading">
                    <div class="liner">
                      <h3>备注信息加载中...</h3>
                      <img alt="Dots-white" src="<%=request.getContextPath()%>/images/dots-white.gif" />
                    </div>
                  </div>
                  <div class="feed_time_line_container">
                    <div class="export_note"><a href="#" id="export_note_link"><i class="fa fa-fw fa-download"></i> 导出备注</a></div>
                    <div class="feed_time_line" id="noteslist"></div>
                  </div>
                </div>
                <div id="people" style="display:none" class="switchableContainer">
                  <div class="blank_slate_layout" id="peoples_none">
                    <div class="graphic" style="background-image:url(<%=request.getContextPath()%>/images/blankslate_icon_parties.png);"></div>
                    <div class="content" id="addLinkPerson">
                      <h1>创建公司联系人</h1>
                      <p>
                      创建联系人，并保存与之相关的记录，比如邮件，电话，会议等。这样您会很容易的看到该客户的进展情况。以及谁在和该客户联系。
                      </p>
                      <div class="menu_container controls" id="addFirstContract">
                        <a href="#" target="_blank" class="button green create"><i class="fa fa-user"></i> 添加第一个联系人</a>
                      </div>
                    </div>
                  </div>
                  <div id="peoples_list">
                    <div id="addLinkPerson2"><a href="#" target="_blank" class="button green create"><i class="fa fa-user"></i> 添加联系人</a></div>
                    <div class="searchresult"><table class="index" id="searchresult_table"></table></div>
                  </div>
                </div>
                <div id="callRecords" style="display:none" class="switchableContainer">
                  <div id="callRecords_loading" class="loading">
                    <div class="liner">
                      <h3>通话信息加载中...</h3>
                      <img alt="Dots-white" src="<%=request.getContextPath()%>/images/dots-white.gif" />
                    </div>
                  </div>
                  <%if (syncTime != null) {%>
                  <div class="syncTips">#最近同步：<%=Util.date2Str(syncTime)%> （默认每晚凌晨 3 点同步）<a href="#" id="syncCallRecords"><i class="fa fa-refresh"></i> 立即同步</a></div>
                  <%}%>
                  <div class="feed_time_line" id="callRecordslist"></div>
                </div>
                <div id="deals" style="display:none" class="switchableContainer">
                  <div id="deals_loading" class="loading">
                    <div class="liner">
                      <h3>销售机会加载中...</h3>
                      <img alt="Dots-white" src="<%=request.getContextPath()%>/images/dots-white.gif" />
                    </div>
                  </div>
                  <div id="deals_none" class="blank_slate_layout_container" style="display:none">
                    <div class="blank_slate_layout">
                      <div class="graphic" style="background-image:url(<%=request.getContextPath()%>/images/blankslate_icon_deals.png);"></div>
                      <div class="content"><h1>记录您的每一个销售机会</h1>
                        <p>
                          时刻关注每个销售机会的状态（中止，成交或失败），同时记录每个销售机会相关的任务或事件，以及其关键信息，比如合同金额，状态，成交额。
                        </p>
                        <a href="#" target="_blank" id="addFirstDeal" class="button green create"><i class="fa fa-rmb"></i> 添加第一个销售机会</a>
                      </div>
                    </div>
                  </div>
                  <div class="deals" id="deals_list" style="display:none">
                    <a href="#" id="deals_addLink" target="_blank" class="button green create"><i class="fa fa-rmb"></i> 添加销售机会</a>
                    <table class="deals" id="confirm_deals" style="display:none;">
                      <tr>
                        <th colspan="4" class="confirm">
                          <h2>待审核的销售机会</h2>
                        </th>
                      </tr>
                    </table>
                    <table class="deals" id="pending_deals" style="display:none;">
                      <tr>
                        <th colspan="4" class="pending">
                          <h2>跟踪中的销售机会</h2>
                        </th>
                      </tr>
                    </table>
                    <table class="deals" id="won_deals" style="display:none;">
                      <tr>
                        <th colspan="4" class="won">
                          <h2>已经成功的销售机会<span> &mdash; <span id="totalNum"></span> 笔 合计 <span id="totalMoney"></span> 元</span></h2>
                        </th>
                      </tr>
                    </table>
                    <table class="deals" id="lost_deals" style="display:none;">
                      <tr>
                        <th colspan="4" class="lost">
                          <h2>失败的销售机会</h2>
                        </th>
                      </tr>
                    </table>
                  </div>
                </div>
                <div id="dates" style="display:none" class="switchableContainer">
                  <div id="dates_loading" class="loading">
                    <div class="liner">
                      <h3>重要日期加载中...</h3>
                      <img alt="Dots-white" src="<%=request.getContextPath()%>/images/dots-white.gif" />
                    </div>
                  </div>
                  <div class="recordings">
                    <h4>为客户添加重要日期</h4>
                    <p>您设置了重要日期后，到期的当天在系统的右上角会提醒您。</p>
                    <a id="add_contact_date_link" href="#" class="button green"><i class="fa fa-calendar"></i> 添加重要日期</a>
                    <div class="inline_edit" id="add_contact_date_panel" style="display:none;">
                      <div class="inner">
                        <h4>添加一个日期提醒</h4>
                        <div style="padding-bottom:10px;">
                          <select id="contact_date_occasion">
                            <option value="生日">生日</option>
                            <option value="周年纪念">周年纪念</option>
                            <option value="第一次见面">第一次见面</option>
                            <option value="服务到期时间">服务到期时间</option>
                            <option value="">其他...</option>
                          </select>  <input type="text" id="contact_date_custom_description" value="" style="height:18px;width:450px;display:none;">
                        </div>
                        <div>
                          <select id="contact_date_month">
                            <option value="1">一月</option>
                            <option value="2">二月</option>
                            <option value="3">三月</option>
                            <option value="4">四月</option>
                            <option value="5">五月</option>
                            <option value="6">六月</option>
                            <option value="7">七月</option>
                            <option value="8">八月</option>
                            <option value="9">九月</option>
                            <option value="10">十月</option>
                            <option value="11">十一月</option>
                            <option value="12">十二月</option>
                          </select>
                          <select id="contact_date_day">
                            <% for (int i = 1; i < 32; i++) {%>
                            <option value="<%=i%>"><%=i%></option>
                            <%}%>
                          </select>
                          <select id="contact_date_year">
                            <option value="0">每年</option>
                            <% for (int i = 1950; i < 2021; i++) {%>
                            <option value="<%=i%>"><%=i%></option>
                            <%}%>
                          </select>
                        </div>
                        <p id="new_importantDate_button_panel">
                          <a id="add_imporantDate_link" class="button blue small" href="#"><i class="fa fa-check"></i> 创 建</a>
                          <a id="add_imporantDate_cancel_link" class="button grey small" href="#"><i class="fa fa-times"></i> 取消</a>
                        </p>
                       </div>
                    </div>
                  </div>
                  <div id="contact_dates"></div>
                </div>
                <div id="searchEngineResult" style="display:none" class="switchableContainer">
                  <div style="height:30px;"><a id="refreshSearchEngine_link" class="button grey small right" href="#"><i class="fa fa-refresh"></i> 刷新</a></div>
                  <div id="searchEnginestream">
                    <div id="searchEngines" class="recordings"></div>
                    <div id="searchEngines_loading" class="loading">
                      <div class="liner">
                        <h3>相关资讯检索中...</h3>
                        <img alt="Dots-white" src="<%=request.getContextPath()%>/images/dots-white.gif" />
                      </div>
                    </div>
                  </div>
                </div>
                <div id="businessArchives" style="display:none" class="switchableContainer">
                </div>
              </div>
            </td>
            <td class="rightdesc">
              <div class="container">
                <h1>任务</h1>
                <div class="popbox floatleft">
                  <a class="open" id="add_taskLink" href="#"><i class="fa fa-plus"></i> 添加任务</a>
                  <div class='collapse'>
                    <div class='box'>
                      <div class='arrow'></div><div class='arrow-border'></div>
                      <form class="task" id="newCustomerTask">
                        <h3>添加一个任务</h3>
                        <p class="task_body">
                          <input class="autofocus" id="customerTaskTitle" size="25" type="text" />
                        </p>
                        <div>
                          <h5>到期时间</h5>
                          <p>
                            <div class="datetimepicker_container"><input class="autofocus dueDate" id="customerTaskDueDate" size="25" type="text" /></div>
                          </p>
                          <h5>任务负责人</h5>
                          <p>
                            <select id="customerTaskResponsibleUserId" class="responsibleUserId"></select></p>
                          <h5>任务分类</h5>
                          <p>
                            <select id="customerTaskCategoryId" class="categoryId"></select>
                            <% if (user.isAdmin) {%>
                            <a href="<%=request.getContextPath()%>/taskcategory" class="edit_categories">编辑分类</a>
                            <% }%>
                          </p>
                          <p>
                            <input class="checkbox" id="customerTaskVisible" name="customerTaskVisible" type="checkbox" value="1" />
                            <label for="customerTaskVisible">所有人可以看见这个任务</label>
                          </p>
                        </div>
                        <div class="submit">
                          <a id="add_customer_task_button" class="button blue small closePopbox" href="#"><i class="fa fa-check"></i> 添加任务</a>
                          &nbsp;&nbsp;<a href="#" class="closePopbox">取消</a>
                        </div>
                      </form>
                    </div>
                  </div>
                </div>
                <div class="clearfix"></div>
                <div class="tasklist overdue" id="overdueTasks">
                  <h6> 已过期 </h6>
                  <ul class="tasks"></ul>
                </div>
                <div class="tasklist" id="todayTasks">
                  <h6> 今天 </h6>
                  <ul class="tasks"></ul>
                </div>
                <div class="tasklist" id="tomorrowTasks">
                  <h6> 明天 </h6>
                  <ul class="tasks"></ul>
                </div>
                <div class="tasklist" id="thisWeekTasks">
                  <h6> 本周 </h6>
                  <ul class="tasks"></ul>
                </div>
                <div class="tasklist" id="nextWeekTasks">
                  <h6> 下周 </h6>
                  <ul class="tasks"></ul>
                </div>
                <div class="tasklist" id="laterTasks">
                  <h6> 以后 </h6>
                  <ul class="tasks"></ul>
                </div>
                <div id="customer_assignDate">
                  <h1>分配时间</h1>
                  <div class="data_group"></div>
                </div>
                <div id="customer_category_div">
                  <h1>客户分类</h1>
                  <div class="customer_category">
                    <select id="change_categoryId" class="max-width">
                    <option value="0">无</option>
                    <%for (Map<String, Object> category:customerCategorys) { %>
                    <option value="<%=category.get("CategoryId")%>"><%=Util.HTMLEncode(Util.showMaxLen((String)category.get("CategoryName"), 12))%></option>
                    <%}%>
                    </select>
                  </div>
                </div>
                <div id="permissionsChange_div">
                  <h1>客户所属变更历史</h1>
                  <div id="permissionsChangeDetail"></div>
                </div>
                <div id="peoples_div">
                  <h1>联系人信息</h1>
                  <ul class="peoples_desc" id="peoples_desc"></ul>
                </div>
                <h1>详细信息</h1>
                <div class="ext data_group">
                  <div class="label">创建时间</div>
                  <div id="ext_createDate" class="value item"></div>
                </div>
                <div id="ext_email_address" class="email_address data_group ext_info">
                </div>
                <div id="ext_phone_number" class="phone_number data_group ext_info">
                </div>
                <div id="ext_website" class="website data_group ext_info">
                </div>
                <div id="ext_address" class="address data_group ext_info">
                </div>
                <div id="ext_other" class="ext data_group ext_info">
                </div>
                <div id="ext_remark" class="data_group">
                  <div class="label">简介</div>
                  <div class="value"></div>
                </div>
              </div>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>

  <div id="callphone-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">拨打电话</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <div class="callphonelist" id="callphonelist"></div>
    </div>
  </div>

  <div id="emailEditor-popup" class="white-popup big mfp-hide">
    <div class="popup-title"><span class="title">发送邮件</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <div id="emailEditor" class="mailEditoer">
      <form action="" autocomplete="off" method="post" id="mailForm">
        <div class="form-group">
          <label for="to">收件人:</label>
          <input type="text" title="多个邮箱之间用分号分割，比如user1@test.com; user2@test.com" id="email_to" tabindex="1">
        </div>
        <div class="form-group">
          <label for="subject">主题:</label>
          <input type="text" id="email_subject" tabindex="2">
        </div>
        <div class="file-group">
          <input type="file" id="email_file_upload" name="email_file_upload" />
        </div>
        <div class="message-editor">
          <textarea placeholder="邮件正文 ..." style="height:320px;width:650px;" id="email_message" name="email_message"></textarea>
        </div>
      </form>
      </div>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a style="padding-right:20px;" href="<%=request.getContextPath()%>/users/<%=user.userId%>/edit" target="_blank">设置SMTP信息</a>
        <a id="sendEmail-link" class="button blue small" href="#"><i class="fa fa-check"></i> 发送</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message" id="email_tips_message"></div>
    </div>
  </div>

  <div id="export-popup" class="white-popup big2 mfp-hide">
    <div class="popup-title"><span class="title">导出记录</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <table class="callrecords" style="width:100%;">
        <thead><tr><th width="60">编号</th><th>导出内容</th><th width="160">导出时间</th><th width="150">已导出数/总数</th><th width="80">状态</th><th width="80">操作</th></tr></thead>
        <tbody id="exportList"></tbody>
      </table>
      <div id="exportPageNavi" class="right" style="padding-right:20px;">
        <span id="export_currentpage"></span> / <span id="export_totalpage"></span>
        <a title="上一页" id="export_prev-link" href="#" class="iconbutton"><i class="fa fa-chevron-left"></i></a>
        <a id="export_next-link" title="下一页" href="#" class="iconbutton"><i class="fa fa-chevron-right"></i></a>
      </div>
      <div class="clearfix" style="padding-top:10px;"><i class="fa fa-info-circle"></i> 提示：关闭该窗口，导出不会中断</div>
    </div>
  </div>

  <div class="movebox" id="updateTask">
    <div class='arrow'></div><div class='arrow-border'></div>
    <form class="task">
      <h3>修改任务</h3>
      <p class="task_body">
        <input id="update_taskId" type="hidden" value="" />
        <input class="autofocus" id="update_taskTitle" size="25" type="text" />
      </p>
      <div>
        <h5>到期时间</h5>
        <p>
          <div class="datetimepicker_container"><input class="autofocus dueDate" id="update_dueDate" size="25" type="text" /></div>
        </p>
        <h5>任务负责人</h5>
        <p>
          <select id="update_responsibleUserId" class="responsibleUserId"></select></p>
        <h5>任务分类</h5>
        <p>
          <select id="update_categoryId" class="categoryId"></select>
          <% if (user.isAdmin) {%>
          <a href="<%=request.getContextPath()%>/taskcategory" class="edit_categories">编辑分类</a>
          <% }%>
        </p>
        <p>
          <input class="checkbox" id="update_taskVisible" type="checkbox" value="1" />
          <label for="update_taskVisible">所有人可以看见这个任务</label>
        </p>
      </div>
      <div class="submit">
        <a id="update_task_button" class="button blue small closePopbox" href="#"><i class="fa fa-check"></i> 修改任务</a>
        &nbsp;&nbsp;<a href="#" class="closePopbox" id="update_task_cancel_link">取消</a>
      </div>
    </form>
  </div>

  <script type="text/javascript" src="<%=request.getContextPath()%>/script/wysihtml5-0.3.0.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-wysihtml5.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-wysihtml5.zh-CN.js"></script>

  <div id="callrecord-popup" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">通话录音</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <div id="jquery_jplayer_1" class="jp-jplayer"></div>
      <div id="jp_container_1" class="jp-audio" role="application" aria-label="media player">
      	<div class="jp-type-single">
      		<div class="jp-gui jp-interface">
      			<div class="jp-controls">
      				<button class="jp-play" role="button" tabindex="0">play</button>
      				<button class="jp-stop" role="button" tabindex="0">stop</button>
      			</div>
      			<div class="jp-progress">
      				<div class="jp-seek-bar">
      					<div class="jp-play-bar"></div>
      				</div>
      			</div>
      			<div class="jp-volume-controls">
      				<button class="jp-mute" role="button" tabindex="0">mute</button>
      				<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
      				<div class="jp-volume-bar">
      					<div class="jp-volume-bar-value"></div>
      				</div>
      			</div>
      			<div class="jp-time-holder">
      				<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
      				<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
      				<div class="jp-toggles">
      					<button class="jp-repeat" role="button" tabindex="0">repeat</button>
      				</div>
      			</div>
      		</div>
      		<div class="jp-details">
      			<div class="jp-title" aria-label="title">&nbsp;</div>
      		</div>
      		<div class="jp-no-solution">
      			<span>您需要升级您的浏览器</span>
      			您的浏览器不支持录音播放，需要升级Flash组件 <a href="http://get.adobe.com/flashplayer/" target="_blank">升级Flash组件</a>.
      		</div>
      	</div>
      </div>
    </div>
  </div>

  <input type="hidden" id="referenceUrl" value="">
  <input type="hidden" id="referenceTitle" value="">
  <input type="hidden" id="referenceId" value="">
  <input type="hidden" id="referenceType" value="">
</body>
</html>